<extend name="Base/common"/>
<!--<script type="text/javascript" src="/SG_Shopwechat/Public/Home/js/iscroll.js"></script>-->
<block name="TITLE"><title>商品列表</title></block>
<block name="body" >
<div  >
    <header style="background-color: #3eacff!important;" data-am-widget="header" class="am-header am-header-default am-header-fixed">
        <div class="am-header-left am-header-nav" style="">
            <a href="{:U('index/index')}" class="">
                <i class="am-header-icon am-icon-home"></i>
            </a>
        </div>
        <h1 class="am-header-title">
            <a href="#title-link" class="">
               &nbsp;{$title}
            </a>
        </h1>
        <div class="am-header-right am-header-nav">

        </div>
           <nav data-am-widget="menu" class="am-menu  am-menu-offcanvas2" data-am-menu-offcanvas>
        <a href="javascript: void(0)" class="am-menu-toggle">
            <i class="am-menu-toggle-icon am-icon-bars"></i>
        </a>
        <div class="am-offcanvas">
            <div class="am-offcanvas-bar am-offcanvas-bar-flip">
                <ul class="am-menu-nav am-avg-sm-3">
                    <li class="">
                        <a href="?" class="am-active">全部</a>
                    </li>
                    <volist name="label" id="labellist">
                        <li >
                            <a href="?label={$key}&chinese={$labellist}" class="">{$labellist}</a>
                        </li>
                    </volist>
                </ul>
            </div>
        </div>
    </nav>
    </header>
    <div class="">  
        <form action="" method="get" class="am-text-center am-form-group am-topbar-fixed-top" style="background: #FFF;display: block;top:auto !important;">
          <div class="am-g" style="margin-top: 18px;">
                  <input style="height: 30px;border: 2px solid #3BB4F2;border-top-left-radius:5px;border-bottom-left-radius:5px;" class=" am-input-lg search_good_name" id="searchinput" name="good_name" value="{$good_name}" style="border: 1px solid #0E90D2;">
                  <button  style="height: 30px;left:-9px;position: relative;border-top-right-radius:5px;border-bottom-right-radius:5px;border:0; " type="submit" class="am-margin-0 am-btn-secondary am-btn  am-btn-sm am-margin-sm sg-search  am-margin-left-0"><i class="am-icon-search"></i>搜索</button>
          </div>
        </form>
    </div>    
    <div class="" style="padding-top: 4em;">
    <ul class="am-list ">
      <!--缩略图在标题左边-->
      <volist name='goodlist' id='goods' empty="没有查询到该商品的信息">
          <li class=" am-list-item-desced am-list-item-thumbed am-list-item-thumb-left" style="width: 100%;border-bottom: none;">
              <div class="am-margin-0 am-g">
                  <a href="{:U('Product/ProductDetails')}?pid={$goods.id}">
                      <div class="am-radius am-u-sm-4 am-padding-top-xs " style="">
                          <img src="{$goods.imgurl}?imageView2/1/w/200/h/200/q/100" style="width: 100%"  />
                      </div>
                  </a>
                  <div class="am-list-main am-u-sm-8 am-padding-left-0">
                      <div class="am-g">
                          <a href="{:U('Product/ProductDetails')}?pid={$goods.id}" class="am-u-sm-10">
                              <div  style="width:14em;color:#333;font-weight: bold;white-space:nowrap;overflow:hidden;text-overflow:ellipsis;">
                                  {$goods.name}
                              </div>
                          </a>
                          <div class="am-padding-left-0 am-padding-top-0 am-u-sm-2">
                              <if condition="strpos($goods['tagarray'],'SINGLE') gt -1">
                                  <a href="{:U('BuyNow/add',array('id'=>$goods['id']))}"><i class="am-text-danger am-icon am-icon-credit-card am-icon-sm" data-id="{$goods.id}"  id="{$goods.id}"   style="width:2em;height: 2em"></i></a>
                                  <else/>
                                  <if condition="($goods.inventory lt 0)OR($goods.inventory eq 0)">
                                      <span class="am-btn am-btn-warning am-radius " style="font-size: 14px;padding:2px;">售罄</span>
                                      <else/>
                                      <if condition="($goods.iscart eq true)">
                                          <img onclick="dele(this)" data-id="{$goods.id}"  id="del_{$goods.id}" src="__IMG__/removecart.png" class="" style="width:35px;height: 30px;">
                                          <img onclick="add(this)"  data-id="{$goods.id}" id="add_{$goods.id}" src="__IMG__/addcart.png" class="" style="width:35px;height: 30px;display: none;"  />
                                          <else/>
                                          <img onclick="dele(this)" data-id="{$goods.id}" id="del_{$goods.id}" src="__IMG__/removecart.png" class="" style="width:35px;height: 30px;display: none;"/>
                                          <img onclick="add(this)"  data-id="{$goods.id}"id="add_{$goods.id}" src="__IMG__/addcart.png" class="" style="width:35px;height: 30px;"/>
                                      </if>
                                  </if>
                              </if>
                          </div>
                      </div>

                      <div class="am-margin-0" style="border:1px solid #ddd;padding: 1px;">
                              <div style="border-bottom: 1px solid #ddd;">
                                  <span class="" style="color:#777;font-size: small;">规格：{$goods.quantity}&nbsp;</span>
                              </div>
                              <div class="am-g" style="color:#777;font-size: small">
                                  <div class="am-u-sm-6 am-padding-right-0" >产地：{$goods.origin} </div>
                                  <div class="am-u-sm-6 am-padding-horizontal-0" style="border-left: 1px solid #ddd;">库存：{$goods.inventory}</div>
                              </div>
                      </div>

                      <div>

                      </div>
                      <div class="am-g">
                          <div class=" am-g">
                              <span class=" am-text-default am-u-sm-4 am-padding-left-lg" style="font-size: smaller">
                                  原价
                               </span>
                              <if condition="$goods['price1'] gt 0">
                                  <span class=" am-text-default am-u-sm-4" style="font-size: smaller">
                                      ≥{$goods.num1}件
                                  </span>
                              </if>
                              <if condition="$goods['price2'] gt 0">
                                  <span class=" am-text-default am-u-sm-4" style="font-size: smaller">
                                      ≥{$goods.num2}件
                                  </span>
                                  <else/>
                                  <span class="am-u-sm-4"></span>
                              </if>
                          </div>
                          <div class=" am-g ">
                              <span class=" am-text-warning am-u-sm-4 " style="font-size: larger">￥{$goods.price}</span>
                              <if condition="$goods['price1'] gt 0">
                                  <span class=" am-text-danger am-u-sm-4 am-padding-left-0" style="font-size: larger">￥{$goods.price1}</span>
                              </if>
                              <if condition="$goods['price2'] gt 0">
                                  <span class="  am-u-sm-4 am-padding-left-0" style="font-size: larger;color:red;">￥{$goods.price2}</span>
                                  <else/>
                                  <span class="am-u-sm-4"></span>
                              </if>
                              <!--<div style="color:#777;font-size: small;">单价：￥{$goods.unitprice}</div>-->
                          </div>
                      </div>
                  </div>
              </div>
          </li>
      </volist>
    </ul>        
  </div>
 </div>   
 </block>
 <block name="script">
<script  type="text/javascript">
    function add(o){
        var pid=$(o).data('id');
        var url = "{:U('Pricelist/addToCart')}";
        var params = "pid="+pid;
        $.post(url,{pid:pid},function(msg){
            $('#add_'+pid).hide();
            $('#del_'+pid).show();
        });
    }
    function dele(o){
        var pid=$(o).data('id');
        var url = "{:U('Pricelist/delFromCart')}";
        var params = "pid="+pid;
        $.post(url,{pid:pid},function(msg){
            $('#add_'+pid).show();
            $('#del_'+pid).hide();
        });
    }
    $(".am-icon-remove").click(function(){
        $(this).prev().val("");
    });
    
</script>
</block>  

